package com.ruoyi.system.mapper;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.TbDevice;
import com.ruoyi.system.domain.TbTask;
import com.ruoyi.system.domain.vo.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.NotNull;

/**
 * 设备信息Mapper接口
 *
 * @author ruoyi
 * @date 2025-07-23
 */
public interface TbDeviceMapper {
    /**
     * 查询设备信息
     *
     * @param id 设备信息主键
     * @return 设备信息
     */
    public TbDevice selectTbDeviceById(Long id);

    /**
     * 查询设备信息列表
     *
     * @param tbDevice 设备信息
     * @return 设备信息集合
     */
    public List<TbDevice> selectTbDeviceList(TbDevice tbDevice);

    /**
     * 新增设备信息
     *
     * @param tbDevice 设备信息
     * @return 结果
     */
    public int insertTbDevice(TbDevice tbDevice);

    /**
     * 修改设备信息
     *
     * @param tbDevice 设备信息
     * @return 结果
     */
    public int updateTbDevice(TbDevice tbDevice);

    /**
     * 删除设备信息
     *
     * @param id 设备信息主键
     * @return 结果
     */
    public int deleteTbDeviceById(Long id);

    /**
     * 批量删除设备信息
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTbDeviceByIds(Long[] ids);

    List<TbDeviceVO> selectTbDeviceLis(@Param("vo") TbDeviceVO vo);

    int updateDevice(@Param("airplaneCode") String planeCode, @Param("id") Long deviceId);

    List<TbDevice> selectCanRelDev();

    TbDeviceVO selectTbDeviceInfoById(Long id);

    List<TbDeviceVO> selectListByDeviceSns(@Param("list") List<String> deviceSns);

    List<TbDevice> selectByDeviceSns(@Param("list") List<String> deviceSns);

    List<TbDevice> selectListByPlaneCodes(@Param("list") List<String> planeCodes);

    List<TbDeviceVO> selectByDeviceSnList(@Param("list") List<String> deviceSnList, @Param("deviceSn") String deviceSn);

    List<TbDevice> selectByDeviceSnsWithFilter(@Param("list") List<String> deviceSns, @Param("planeCode") String planeCode);

    int selectCountrel();

    int selectDeviceCountOnline();

    List<String> selectplaneCodeList();

    List<TbDevice> selectList();

    List<TbDeviceVO> selectListByPlaneCode(@Param("planeCode") String planeCode,@Param("deviceSn") String deviceSn);


    TbDevice selectTbDeviceByDevSn(String devSn);

    List<Map<String, Object>> selectDeviceGroupByPlane(TbTask tbTask);

    List<Map<String, Object>> selectDeviceStatsByTask(TbTaskVO query);

    TbDevice selectByDeviceSn(String devSN);

    int updateDevicestatusByDevSN(String devSN);

    FileDownloadInfo selectDeviceInfo(String devSN);

    Long validateDevice(String devSN);

    DeviceStorageInfo getDeviceFreeStorage(String devSN);

    DeviceInfoVO selectByDeviceInfoSn(String devSN);

    void updateDeviceRomUsage(@Param("devSN") String devSN, @Param("packageSize") Double packageSize);

    String getDeviceModelBySn(String devSN);

   // List<Long> selectOnlineAndRegisteredAndRegisteredDeviceIds();


    List<Long> selectOnlineAndRegisteredDeviceIds();

    TbDevice selectByDevSn(@Param("devSN") String sn);

    List<Long> selectTbDeviceSnBy(@Param("list") List<String> planeCodes);

    List<TbDevice> selectByAirplaneCodes(@Param("planeCodes") List<String> planeCodes);

    List<TbDevice> selectByDeviceSnsList(@Param("deviceSnList") List<String> planeDeviceSns);

}
